package com.qianclass.talklive.app.utils;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.daimajia.numberprogressbar.NumberProgressBar;
import com.qianclass.talklive.R;

/**
 * Created by admin on 2017/2/20.
 */

public class UpPhotoProgressDialog extends Dialog {

    public NumberProgressBar squareProgressBar;
    private Bitmap bitmap;
    private ImageView imageView;
    private TextView cancel;
    public TextView textView;

    public UpPhotoProgressDialog(Context context , Bitmap imageBitmap , CancelCallBack mCancelCallBack) {
        super(context , R.style.ActionProgressDialogStyle);
        bitmap = imageBitmap;
        this.mCancelCallBack = mCancelCallBack;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.up_photo_progress_dialog_layout);
        textView = (TextView) findViewById(R.id.text);
        cancel = (TextView) findViewById(R.id.cancel);
        cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mCancelCallBack.cancelOnClick();
            }
        });
        imageView = (ImageView) findViewById(R.id.image);
        imageView.setImageBitmap(bitmap);
        squareProgressBar = (NumberProgressBar) findViewById(R.id.progressBar);
        // 设置ProgressBar的最大值
        squareProgressBar.setMax(100);
        // 设置ProgressBar的当前值
        squareProgressBar.setProgress(0);
    }


    public CancelCallBack mCancelCallBack;
    public interface CancelCallBack {
        void cancelOnClick();
    }

}
